<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // replace()   替换  , 默认替换第一个

        var str = 'tmd , js真tmd简单TMd' ;

        // str = str.replace('tmd' , '**') ;

        // console.log(str);

        str = str.replace(/tmd/ig , '**') ;

        console.log(str);



        

    </script>
    
</body>
</html>